<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, StandaloneDeriving, GeneralizedNewtypeDeriving #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Types for referring to remote objects in Remote GHCi.  For more</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- details, see Note [External GHCi pointers] in compiler/GHC/Runtime/Interpreter.hs</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- For details on Remote GHCi, see Note [Remote GHCi] in</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- compiler/GHC/Runtime/Interpreter.hs.</span><span>
</span><span id="line-9"></span><span class="hs-comment">--</span><span>
</span><span id="line-10"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHCi.RemoteTypes</span><span>
</span><span id="line-11"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier">RemotePtr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#toRemotePtr"><span class="hs-identifier">toRemotePtr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#fromRemotePtr"><span class="hs-identifier">fromRemotePtr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#castRemotePtr"><span class="hs-identifier">castRemotePtr</span></a></span><span>
</span><span id="line-12"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#HValue"><span class="hs-identifier">HValue</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-13"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier">RemoteRef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#mkRemoteRef"><span class="hs-identifier">mkRemoteRef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#localRef"><span class="hs-identifier">localRef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#freeRemoteRef"><span class="hs-identifier">freeRemoteRef</span></a></span><span>
</span><span id="line-14"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#HValueRef"><span class="hs-identifier">HValueRef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#toHValueRef"><span class="hs-identifier">toHValueRef</span></a></span><span>
</span><span id="line-15"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier">ForeignRef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#mkForeignRef"><span class="hs-identifier">mkForeignRef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#withForeignRef"><span class="hs-identifier">withForeignRef</span></a></span><span>
</span><span id="line-16"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignHValue"><span class="hs-identifier">ForeignHValue</span></a></span><span>
</span><span id="line-17"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#unsafeForeignRefToRemoteRef"><span class="hs-identifier">unsafeForeignRefToRemoteRef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#finalizeForeignRef"><span class="hs-identifier">finalizeForeignRef</span></a></span><span>
</span><span id="line-18"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-comment">-- See note [Why do we import Prelude here?]</span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#"><span class="hs-identifier">Control.DeepSeq</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Word.html#"><span class="hs-identifier">Data.Word</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.html#"><span class="hs-identifier">Foreign</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Foreign.ForeignPtr.Imp.html#newForeignPtr"><span class="hs-identifier">newForeignPtr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Concurrent.html#"><span class="hs-identifier">Foreign.Concurrent</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.html#"><span class="hs-identifier">Data.Binary</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Unsafe.Coerce.html#"><span class="hs-identifier">Unsafe.Coerce</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#"><span class="hs-identifier">GHC.ForeignPtr</span></a></span><span>
</span><span id="line-29"></span><span>
</span><span id="line-30"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- RemotePtr</span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span class="hs-comment">-- Static pointers only; don't use this for heap-resident pointers.</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- Instead use HValueRef. We will fix the remote pointer to be 64 bits. This</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- should cover 64 and 32bit systems, and permits the exchange of remote ptrs</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- between machines of different word size. For example, when connecting to</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- an iserv instance on a different architecture with different word size via</span><span>
</span><span id="line-38"></span><span class="hs-comment">-- -fexternal-interpreter.</span><span>
</span><span id="line-39"></span><span class="hs-keyword">newtype</span><span> </span><span id="RemotePtr"><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-var">RemotePtr</span></a></span></span><span> </span><span id="local-6989586621679087715"><span class="annot"><a href="#local-6989586621679087715"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="RemotePtr"><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-var">RemotePtr</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-identifier hs-type">Word64</span></a></span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span id="local-6989586621679087718"><span class="annot"><a href="GHCi.RemoteTypes.html#toRemotePtr"><span class="hs-identifier hs-type">toRemotePtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087718"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087718"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-42"></span><span id="toRemotePtr"><span class="annot"><span class="annottext">toRemotePtr :: forall a. Ptr a -&gt; RemotePtr a
</span><a href="GHCi.RemoteTypes.html#toRemotePtr"><span class="hs-identifier hs-var hs-var">toRemotePtr</span></a></span></span><span> </span><span id="local-6989586621679087612"><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679087612"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word64 -&gt; RemotePtr a
forall a. Word64 -&gt; RemotePtr a
</span><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-var">RemotePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WordPtr -&gt; Word64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr a -&gt; WordPtr
forall a. Ptr a -&gt; WordPtr
</span><a href="../../base/src/Foreign.Ptr.html#ptrToWordPtr"><span class="hs-identifier hs-var">ptrToWordPtr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679087612"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span id="local-6989586621679087711"><span class="annot"><a href="GHCi.RemoteTypes.html#fromRemotePtr"><span class="hs-identifier hs-type">fromRemotePtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087711"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087711"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-45"></span><span id="fromRemotePtr"><span class="annot"><span class="annottext">fromRemotePtr :: forall a. RemotePtr a -&gt; Ptr a
</span><a href="GHCi.RemoteTypes.html#fromRemotePtr"><span class="hs-identifier hs-var hs-var">fromRemotePtr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span id="local-6989586621679087606"><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679087606"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WordPtr -&gt; Ptr a
forall a. WordPtr -&gt; Ptr a
</span><a href="../../base/src/Foreign.Ptr.html#wordPtrToPtr"><span class="hs-identifier hs-var">wordPtrToPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word64 -&gt; WordPtr
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679087606"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span id="local-6989586621679087707"><span id="local-6989586621679087708"><span class="annot"><a href="GHCi.RemoteTypes.html#castRemotePtr"><span class="hs-identifier hs-type">castRemotePtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087708"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087707"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-48"></span><span id="castRemotePtr"><span class="annot"><span class="annottext">castRemotePtr :: forall a b. RemotePtr a -&gt; RemotePtr b
</span><a href="GHCi.RemoteTypes.html#castRemotePtr"><span class="hs-identifier hs-var hs-var">castRemotePtr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span id="local-6989586621679087604"><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679087604"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word64 -&gt; RemotePtr b
forall a. Word64 -&gt; RemotePtr a
</span><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-var">RemotePtr</span></a></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679087604"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span id="local-6989586621679087594"><span id="local-6989586621679087596"><span id="local-6989586621679087602"><span id="local-6989586621679087702"><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087702"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-51"></span><span id="local-6989586621679087582"><span id="local-6989586621679087586"><span id="local-6989586621679087591"><span id="local-6989586621679087696"><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.Class.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087696"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-52"></span><span id="local-6989586621679087576"><span id="local-6989586621679087692"><span class="hs-keyword">deriving</span><span> </span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier hs-type">NFData</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087692"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-55"></span><span class="hs-comment">-- HValueRef</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span class="hs-keyword">newtype</span><span> </span><span id="HValue"><span class="annot"><a href="GHCi.RemoteTypes.html#HValue"><span class="hs-identifier hs-var">HValue</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="HValue"><span class="annot"><a href="GHCi.RemoteTypes.html#HValue"><span class="hs-identifier hs-var">HValue</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Any</span></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679087565"><span id="local-6989586621679087568"><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#HValue"><span class="hs-identifier hs-type">HValue</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-60"></span><span>  </span><span id="local-6989586621679087564"><span class="annot"><span class="annottext">show :: HValue -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var hs-var hs-var hs-var">show</span></a></span></span><span> </span><span class="annot"><span class="annottext">HValue
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&lt;HValue&gt;&quot;</span></span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="hs-comment">-- | A reference to a remote value.  These are allocated and freed explicitly.</span><span>
</span><span id="line-63"></span><span class="hs-keyword">newtype</span><span> </span><span id="RemoteRef"><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-var">RemoteRef</span></a></span></span><span> </span><span id="local-6989586621679087691"><span class="annot"><a href="#local-6989586621679087691"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="RemoteRef"><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-var">RemoteRef</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemotePtr"><span class="hs-identifier hs-type">RemotePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679087554"><span id="local-6989586621679087556"><span id="local-6989586621679087560"><span class="annot"><span class="annottext">Int -&gt; RemoteRef a -&gt; ShowS
[RemoteRef a] -&gt; ShowS
RemoteRef a -&gt; String
(Int -&gt; RemoteRef a -&gt; ShowS)
-&gt; (RemoteRef a -&gt; String)
-&gt; ([RemoteRef a] -&gt; ShowS)
-&gt; Show (RemoteRef a)
forall a. Int -&gt; RemoteRef a -&gt; ShowS
forall a. [RemoteRef a] -&gt; ShowS
forall a. RemoteRef a -&gt; String
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [RemoteRef a] -&gt; ShowS
$cshowList :: forall a. [RemoteRef a] -&gt; ShowS
show :: RemoteRef a -&gt; String
$cshow :: forall a. RemoteRef a -&gt; String
showsPrec :: Int -&gt; RemoteRef a -&gt; ShowS
$cshowsPrec :: forall a. Int -&gt; RemoteRef a -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679087544"><span id="local-6989586621679087548"><span id="local-6989586621679087552"><span class="annot"><span class="annottext">Get (RemoteRef a)
[RemoteRef a] -&gt; Put
RemoteRef a -&gt; Put
(RemoteRef a -&gt; Put)
-&gt; Get (RemoteRef a)
-&gt; ([RemoteRef a] -&gt; Put)
-&gt; Binary (RemoteRef a)
forall a. Get (RemoteRef a)
forall a. [RemoteRef a] -&gt; Put
forall a. RemoteRef a -&gt; Put
forall t. (t -&gt; Put) -&gt; Get t -&gt; ([t] -&gt; Put) -&gt; Binary t
putList :: [RemoteRef a] -&gt; Put
$cputList :: forall a. [RemoteRef a] -&gt; Put
get :: Get (RemoteRef a)
$cget :: forall a. Get (RemoteRef a)
put :: RemoteRef a -&gt; Put
$cput :: forall a. RemoteRef a -&gt; Put
</span><a href="#local-6989586621679087544"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Binary</span></a></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span class="hs-comment">-- We can discard type information if we want</span><span>
</span><span id="line-67"></span><span id="local-6989586621679087689"><span class="annot"><a href="GHCi.RemoteTypes.html#toHValueRef"><span class="hs-identifier hs-type">toHValueRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087689"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#HValue"><span class="hs-identifier hs-type">HValue</span></a></span></span><span>
</span><span id="line-68"></span><span id="toHValueRef"><span class="annot"><span class="annottext">toHValueRef :: forall a. RemoteRef a -&gt; RemoteRef HValue
</span><a href="GHCi.RemoteTypes.html#toHValueRef"><span class="hs-identifier hs-var hs-var">toHValueRef</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RemoteRef a -&gt; RemoteRef HValue
forall a b. a -&gt; b
</span><a href="../../base/src/Unsafe.Coerce.html#unsafeCoerce"><span class="hs-identifier hs-var">unsafeCoerce</span></a></span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span class="hs-comment">-- For convenience</span><span>
</span><span id="line-71"></span><span class="hs-keyword">type</span><span> </span><span id="HValueRef"><span class="annot"><a href="GHCi.RemoteTypes.html#HValueRef"><span class="hs-identifier hs-var">HValueRef</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#HValue"><span class="hs-identifier hs-type">HValue</span></a></span><span>
</span><span id="line-72"></span><span>
</span><span id="line-73"></span><span class="hs-comment">-- | Make a reference to a local value that we can send remotely.</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- This reference will keep the value that it refers to alive until</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- 'freeRemoteRef' is called.</span><span>
</span><span id="line-76"></span><span id="local-6989586621679087685"><span class="annot"><a href="GHCi.RemoteTypes.html#mkRemoteRef"><span class="hs-identifier hs-type">mkRemoteRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679087685"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087685"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-77"></span><span id="mkRemoteRef"><span class="annot"><span class="annottext">mkRemoteRef :: forall a. a -&gt; IO (RemoteRef a)
</span><a href="GHCi.RemoteTypes.html#mkRemoteRef"><span class="hs-identifier hs-var hs-var">mkRemoteRef</span></a></span></span><span> </span><span id="local-6989586621679087536"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679087536"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-78"></span><span>  </span><span id="local-6989586621679087535"><span class="annot"><span class="annottext">StablePtr a
</span><a href="#local-6989586621679087535"><span class="hs-identifier hs-var">sp</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">a -&gt; IO (StablePtr a)
forall a. a -&gt; IO (StablePtr a)
</span><a href="../../base/src/GHC.Stable.html#newStablePtr"><span class="hs-identifier hs-var">newStablePtr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679087536"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-79"></span><span>  </span><span class="annot"><span class="annottext">RemoteRef a -&gt; IO (RemoteRef a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(RemoteRef a -&gt; IO (RemoteRef a))
-&gt; RemoteRef a -&gt; IO (RemoteRef a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">RemotePtr () -&gt; RemoteRef a
forall a. RemotePtr () -&gt; RemoteRef a
</span><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-var">RemoteRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr () -&gt; RemotePtr ()
forall a. Ptr a -&gt; RemotePtr a
</span><a href="GHCi.RemoteTypes.html#toRemotePtr"><span class="hs-identifier hs-var">toRemotePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StablePtr a -&gt; Ptr ()
forall a. StablePtr a -&gt; Ptr ()
</span><a href="../../base/src/GHC.Stable.html#castStablePtrToPtr"><span class="hs-identifier hs-var">castStablePtrToPtr</span></a></span><span> </span><span class="annot"><span class="annottext">StablePtr a
</span><a href="#local-6989586621679087535"><span class="hs-identifier hs-var">sp</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="hs-comment">-- | Convert an HValueRef to an HValue.  Should only be used if the HValue</span><span>
</span><span id="line-82"></span><span class="hs-comment">-- originated in this process.</span><span>
</span><span id="line-83"></span><span id="local-6989586621679087676"><span class="annot"><a href="GHCi.RemoteTypes.html#localRef"><span class="hs-identifier hs-type">localRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087676"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621679087676"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-84"></span><span id="localRef"><span class="annot"><span class="annottext">localRef :: forall a. RemoteRef a -&gt; IO a
</span><a href="GHCi.RemoteTypes.html#localRef"><span class="hs-identifier hs-var hs-var">localRef</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span id="local-6989586621679087532"><span class="annot"><span class="annottext">RemotePtr ()
</span><a href="#local-6989586621679087532"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-85"></span><span>  </span><span class="annot"><span class="annottext">StablePtr a -&gt; IO a
forall a. StablePtr a -&gt; IO a
</span><a href="../../base/src/GHC.Stable.html#deRefStablePtr"><span class="hs-identifier hs-var">deRefStablePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr () -&gt; StablePtr a
forall a. Ptr () -&gt; StablePtr a
</span><a href="../../base/src/GHC.Stable.html#castPtrToStablePtr"><span class="hs-identifier hs-var">castPtrToStablePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RemotePtr () -&gt; Ptr ()
forall a. RemotePtr a -&gt; Ptr a
</span><a href="GHCi.RemoteTypes.html#fromRemotePtr"><span class="hs-identifier hs-var">fromRemotePtr</span></a></span><span> </span><span class="annot"><span class="annottext">RemotePtr ()
</span><a href="#local-6989586621679087532"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="hs-comment">-- | Release an HValueRef that originated in this process</span><span>
</span><span id="line-88"></span><span id="local-6989586621679087672"><span class="annot"><a href="GHCi.RemoteTypes.html#freeRemoteRef"><span class="hs-identifier hs-type">freeRemoteRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087672"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-89"></span><span id="freeRemoteRef"><span class="annot"><span class="annottext">freeRemoteRef :: forall a. RemoteRef a -&gt; IO ()
</span><a href="GHCi.RemoteTypes.html#freeRemoteRef"><span class="hs-identifier hs-var hs-var">freeRemoteRef</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span id="local-6989586621679087529"><span class="annot"><span class="annottext">RemotePtr ()
</span><a href="#local-6989586621679087529"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-90"></span><span>  </span><span class="annot"><span class="annottext">StablePtr Any -&gt; IO ()
forall a. StablePtr a -&gt; IO ()
</span><a href="../../base/src/GHC.Stable.html#freeStablePtr"><span class="hs-identifier hs-var">freeStablePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr () -&gt; StablePtr Any
forall a. Ptr () -&gt; StablePtr a
</span><a href="../../base/src/GHC.Stable.html#castPtrToStablePtr"><span class="hs-identifier hs-var">castPtrToStablePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RemotePtr () -&gt; Ptr ()
forall a. RemotePtr a -&gt; Ptr a
</span><a href="GHCi.RemoteTypes.html#fromRemotePtr"><span class="hs-identifier hs-var">fromRemotePtr</span></a></span><span> </span><span class="annot"><span class="annottext">RemotePtr ()
</span><a href="#local-6989586621679087529"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-comment">-- | An HValueRef with a finalizer</span><span>
</span><span id="line-93"></span><span class="hs-keyword">newtype</span><span> </span><span id="ForeignRef"><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-var">ForeignRef</span></a></span></span><span> </span><span id="local-6989586621679087660"><span class="annot"><a href="#local-6989586621679087660"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="ForeignRef"><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-var">ForeignRef</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier hs-type">ForeignPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span id="local-6989586621679087667"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier hs-type">NFData</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087667"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-96"></span><span>  </span><span id="local-6989586621679087524"><span class="annot"><span class="annottext">rnf :: ForeignRef a -&gt; ()
</span><a href="../../deepseq/src/Control.DeepSeq.html#rnf"><span class="hs-identifier hs-var hs-var hs-var hs-var">rnf</span></a></span></span><span> </span><span id="local-6989586621679087522"><span class="annot"><span class="annottext">ForeignRef a
</span><a href="#local-6989586621679087522"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ForeignRef a
</span><a href="#local-6989586621679087522"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignRef a -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span class="hs-keyword">type</span><span> </span><span id="ForeignHValue"><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignHValue"><span class="hs-identifier hs-var">ForeignHValue</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#HValue"><span class="hs-identifier hs-type">HValue</span></a></span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span class="hs-comment">-- | Create a 'ForeignRef' from a 'RemoteRef'.  The finalizer</span><span>
</span><span id="line-101"></span><span class="hs-comment">-- should arrange to call 'freeHValueRef' on the 'HValueRef'.  (since</span><span>
</span><span id="line-102"></span><span class="hs-comment">-- this function needs to be called in the process that created the</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- 'HValueRef', it cannot be called directly from the finalizer).</span><span>
</span><span id="line-104"></span><span id="local-6989586621679087663"><span class="annot"><a href="GHCi.RemoteTypes.html#mkForeignRef"><span class="hs-identifier hs-type">mkForeignRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087663"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087663"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-105"></span><span id="mkForeignRef"><span class="annot"><span class="annottext">mkForeignRef :: forall a. RemoteRef a -&gt; IO () -&gt; IO (ForeignRef a)
</span><a href="GHCi.RemoteTypes.html#mkForeignRef"><span class="hs-identifier hs-var hs-var">mkForeignRef</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span id="local-6989586621679087519"><span class="annot"><span class="annottext">RemotePtr ()
</span><a href="#local-6989586621679087519"><span class="hs-identifier hs-var">hvref</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679087518"><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621679087518"><span class="hs-identifier hs-var">finalizer</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-106"></span><span>  </span><span class="annot"><span class="annottext">ForeignPtr () -&gt; ForeignRef a
forall a. ForeignPtr () -&gt; ForeignRef a
</span><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-var">ForeignRef</span></a></span><span> </span><span class="annot"><span class="annottext">(ForeignPtr () -&gt; ForeignRef a)
-&gt; IO (ForeignPtr ()) -&gt; IO (ForeignRef a)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr () -&gt; IO () -&gt; IO (ForeignPtr ())
forall a. Ptr a -&gt; IO () -&gt; IO (ForeignPtr a)
</span><a href="../../base/src/Foreign.Concurrent.html#newForeignPtr"><span class="hs-identifier hs-var">newForeignPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RemotePtr () -&gt; Ptr ()
forall a. RemotePtr a -&gt; Ptr a
</span><a href="GHCi.RemoteTypes.html#fromRemotePtr"><span class="hs-identifier hs-var">fromRemotePtr</span></a></span><span> </span><span class="annot"><span class="annottext">RemotePtr ()
</span><a href="#local-6989586621679087519"><span class="hs-identifier hs-var">hvref</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621679087518"><span class="hs-identifier hs-var">finalizer</span></a></span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-comment">-- | Use a 'ForeignHValue'</span><span>
</span><span id="line-109"></span><span id="local-6989586621679087654"><span id="local-6989586621679087655"><span class="annot"><a href="GHCi.RemoteTypes.html#withForeignRef"><span class="hs-identifier hs-type">withForeignRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087655"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087655"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621679087654"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621679087654"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-110"></span><span id="withForeignRef"><span class="annot"><span class="annottext">withForeignRef :: forall a b. ForeignRef a -&gt; (RemoteRef a -&gt; IO b) -&gt; IO b
</span><a href="GHCi.RemoteTypes.html#withForeignRef"><span class="hs-identifier hs-var hs-var">withForeignRef</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span id="local-6989586621679087515"><span class="annot"><span class="annottext">ForeignPtr ()
</span><a href="#local-6989586621679087515"><span class="hs-identifier hs-var">fp</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679087514"><span class="annot"><span class="annottext">RemoteRef a -&gt; IO b
</span><a href="#local-6989586621679087514"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-111"></span><span>   </span><span class="annot"><span class="annottext">ForeignPtr () -&gt; (Ptr () -&gt; IO b) -&gt; IO b
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/GHC.ForeignPtr.html#withForeignPtr"><span class="hs-identifier hs-var">withForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr ()
</span><a href="#local-6989586621679087515"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RemoteRef a -&gt; IO b
</span><a href="#local-6989586621679087514"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(RemoteRef a -&gt; IO b) -&gt; (Ptr () -&gt; RemoteRef a) -&gt; Ptr () -&gt; IO b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">RemotePtr () -&gt; RemoteRef a
forall a. RemotePtr () -&gt; RemoteRef a
</span><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-var">RemoteRef</span></a></span><span> </span><span class="annot"><span class="annottext">(RemotePtr () -&gt; RemoteRef a)
-&gt; (Ptr () -&gt; RemotePtr ()) -&gt; Ptr () -&gt; RemoteRef a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr () -&gt; RemotePtr ()
forall a. Ptr a -&gt; RemotePtr a
</span><a href="GHCi.RemoteTypes.html#toRemotePtr"><span class="hs-identifier hs-var">toRemotePtr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span id="local-6989586621679087646"><span class="annot"><a href="GHCi.RemoteTypes.html#unsafeForeignRefToRemoteRef"><span class="hs-identifier hs-type">unsafeForeignRefToRemoteRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087646"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-type">RemoteRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087646"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-114"></span><span id="unsafeForeignRefToRemoteRef"><span class="annot"><span class="annottext">unsafeForeignRefToRemoteRef :: forall a. ForeignRef a -&gt; RemoteRef a
</span><a href="GHCi.RemoteTypes.html#unsafeForeignRefToRemoteRef"><span class="hs-identifier hs-var hs-var">unsafeForeignRefToRemoteRef</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span id="local-6989586621679087511"><span class="annot"><span class="annottext">ForeignPtr ()
</span><a href="#local-6989586621679087511"><span class="hs-identifier hs-var">fp</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-115"></span><span>  </span><span class="annot"><span class="annottext">RemotePtr () -&gt; RemoteRef a
forall a. RemotePtr () -&gt; RemoteRef a
</span><a href="GHCi.RemoteTypes.html#RemoteRef"><span class="hs-identifier hs-var">RemoteRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr () -&gt; RemotePtr ()
forall a. Ptr a -&gt; RemotePtr a
</span><a href="GHCi.RemoteTypes.html#toRemotePtr"><span class="hs-identifier hs-var">toRemotePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignPtr () -&gt; Ptr ()
forall a. ForeignPtr a -&gt; Ptr a
</span><a href="../../base/src/GHC.ForeignPtr.html#unsafeForeignPtrToPtr"><span class="hs-identifier hs-var">unsafeForeignPtrToPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr ()
</span><a href="#local-6989586621679087511"><span class="hs-identifier hs-var">fp</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span id="local-6989586621679087643"><span class="annot"><a href="GHCi.RemoteTypes.html#finalizeForeignRef"><span class="hs-identifier hs-type">finalizeForeignRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087643"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-118"></span><span id="finalizeForeignRef"><span class="annot"><span class="annottext">finalizeForeignRef :: forall a. ForeignRef a -&gt; IO ()
</span><a href="GHCi.RemoteTypes.html#finalizeForeignRef"><span class="hs-identifier hs-var hs-var">finalizeForeignRef</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHCi.RemoteTypes.html#ForeignRef"><span class="hs-identifier hs-type">ForeignRef</span></a></span><span> </span><span id="local-6989586621679087509"><span class="annot"><span class="annottext">ForeignPtr ()
</span><a href="#local-6989586621679087509"><span class="hs-identifier hs-var">fp</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ForeignPtr () -&gt; IO ()
forall a. ForeignPtr a -&gt; IO ()
</span><a href="../../base/src/GHC.ForeignPtr.html#finalizeForeignPtr"><span class="hs-identifier hs-var">finalizeForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr ()
</span><a href="#local-6989586621679087509"><span class="hs-identifier hs-var">fp</span></a></span><span>
</span><span id="line-119"></span></pre></body></html>